<template>
  <div class="record">
    <MyHeader />
    <div class="record_tip">
      <p>温馨提示:</p>
      <p>为提升企业开办效率，新设立企业办理工商登记时，同步办理公章刻制备案，免费为企业刻制发放法定名称章、财务专用章、发票专用章、合同专用章。</p>
      <p>1、如您选择免费刻章，请在本页勾选“免费刻章”，并根据需要选择印章种类，其中“法定名称章”必选，企业印章随营业执照一并发放。</p>
      <p>您在领取公章时，请认真核对公章章面信息、印鉴留存卡信息是否准确无误。如有异议，立即联系公章刻制企业。</p>
      <p>2、如您选择自行刻章，请在本页勾选“自行刻制公章”，请取得《营业执照》后登陆微信公众号“首都治安微提示”办理公章刻制备案。</p>
      <p>3、您可登陆微信公众号“首都治安微提示”了解公章刻制备案相关业务。</p>
    </div>
    <div class="record_qr">
      <!--<img src="../../assets/img/ren.png" alt="">-->
      <br />
      <RadioGroup v-model="applyselect.sealtype">
        <Radio label="1"><span>免费刻章</span></Radio>
        <Radio label="2"><span>自费刻制公章</span></Radio>
      </RadioGroup>
    </div>
    <div class="record_next">
      <Button v-if="applyselect.sealtype === '1'" type="primary" @click="go">下一步</Button>
      <Button v-if="applyselect.sealtype === '2'" type="primary" @click="go">完成</Button>
      <MyFooter />
    </div>
  </div>
</template>

<script>
  import MyHeader from '../../components/MyHeader.vue'
  import MyFooter from '../../components/MyFooter.vue'
  import request from '../../utils/request'
  export default {
    data() {
      return {
        applyselect: {
          sealtype: ''
        }
      }
    },
    methods: {
      go() {
        let postData = new FormData()
        postData.append('pripid', sessionStorage.getItem('pripid'))
        postData.append('gid', sessionStorage.getItem('gid'))
        postData.append('sealtype', JSON.stringify(this.applyselect))

        request.post('/interface/apply/cp/setup/saveSealType.do', postData
        ).then(response => {
          if (response.data.result === 'error') {
            this.$ErrorAlert(response.data.message)
          } else if (response.data.result === 'success') {
            if (this.applyselect.sealtype === '1') {
              this.$router.push({name: 'record_completed'})
            } else {
              this.$router.push({name: 'ApplyModule'})
            }
          }
        })
      },
      querySealType() {
        request.get('/interface/apply/cp/setup/querySealType.do', {gid: sessionStorage.getItem('gid')}
        ).then(response => {
          if (response.data.result === 'error') {
            this.$ErrorAlert(response.data.message)
            return null
          }
          this.applyselect = JSON.parse(response.data.data)
        })
      }
    },
    mounted() {
      this.querySealType()
    },
    components: {
      MyHeader,
      MyFooter
    }
  }

</script>

<style lang="scss">
  .record {
    position: relative;
    min-height: 100%;
    padding-bottom: 4rem;
    &_tip {
      padding: 0 0.54rem;
      >p {
        font-size: 0.5rem;
        margin: 0.32rem 0;
        &:first-child {
          font-size: 0.57rem;
          margin: 0.54rem 0;
        }
        &:nth-child(2) {
          text-indent: 1rem;
          margin: 0.54rem 0;
        }
      }
    }
    &_qr {
      padding: 0.54rem 0;
      text-align: center;
      img {
        height: 3.6rem;
        width: 3.6rem;
        border: 1px solid #eee;
      }
      label {
        font-size: 0.5rem;
      }
    }
    &_next {
      position: absolute;
      bottom: 0;
      width: 100%;
      height: 3.5rem;
      text-align: center;
      button {
        font-size: 0.57rem;
        padding: 0.28rem 1.44rem;
      }
    }
  }

</style>
